% -*- mode: latex; fill-column: 80; -*-
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[domain=0:30,samples=100]
\draw plot (\x,{(cos(\x r) >= 0 ? -1 : 1});
\end{tikzpicture}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
